﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using cmsservice.Entity;

namespace cmsservice.DAL
{
    public class VoteDal
    {
        

        /// <summary>
        /// 提交问卷
        /// </summary>
        /// <param name="softtype">软件类型</param>
        /// <param name="username">用户名</param>
        /// <param name="area">地区</param>
        /// <param name="mobile">手机号</param>
        /// <param name="results">选择题答案</param>
        /// <param name="remarks">其他答案</param>
        /// <param name="remark1">问答1</param>
        /// <param name="remark2">问答2</param>
        /// <param name="remark3">问答3</param>
        /// <param name="remark4">问答4</param>
        /// <param name="bigtype">问答4问题大类</param>
        /// <param name="smalltype">问答4问题小类</param>
        /// <returns>返回值</returns>
        public string SubmitVote1(int softtype, string username, string area, string mobile, string results, string remarks, string remark1, string remark2, string remark3, string remark4, int bigtype, int smalltype, string strqq)
        {
            try
            {
                Tools tool = new Tools();
                tool.AddSqlParameter("@softtype", SqlDbType.Int, softtype);
                tool.AddSqlParameter("@username", SqlDbType.VarChar, username);
                tool.AddSqlParameter("@mobile", SqlDbType.VarChar, mobile);
                tool.AddSqlParameter("@area", SqlDbType.VarChar, area);
                tool.AddSqlParameter("@results", SqlDbType.VarChar, results);
                tool.AddSqlParameter("@remarks", SqlDbType.VarChar, remarks);
                tool.AddSqlParameter("@remark1", SqlDbType.VarChar, remark1);
                tool.AddSqlParameter("@remark2", SqlDbType.VarChar, remark2);
                tool.AddSqlParameter("@remark3", SqlDbType.VarChar, remark3);
                tool.AddSqlParameter("@remark4", SqlDbType.VarChar, remark4);
                tool.AddSqlParameter("@bigtype", SqlDbType.Int, bigtype);
                tool.AddSqlParameter("@smalltype", SqlDbType.Int, smalltype);
               // tool.AddSqlParameter("@qq", SqlDbType.VarChar, strqq);
                DataSet result = SqlHelper.ExecuteGetDataSet(DBConn.emweb_new, CommandType.StoredProcedure, "ResultAnswer_20120905_Insert", tool.GetSqlParameters());
                return result.Tables[0].Rows[0][0].ToString();
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
        public List<ResultAnswerEntity> GetResultAnswerEntity()
        {
            string strSql = "select * from ResultAnswer where answer>3 and softtype=121 and txtanswer is not null order by answer desc";

            return SqlHelper.GetDataByColumnsLst<ResultAnswerEntity>(DBConn.emweb_new, strSql, null);
        }
    }
}
